#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int trainWays(int num) {
        if (num == 0)return 1;
        if (num == 1)return 1;
        if (num == 2)return 2;
        vector<int> dp(num + 1);
        int mod = 1e9 + 7;
        dp[0] = 0, dp[1] = 1, dp[2] = 2;
        for (int i = 3; i <= num; i++) {
            dp[i] = dp[i - 1] + dp[i - 2];
            dp[i] %= mod;
        }
        return dp[num];
    }
};